package com.yb.bussiness.shoper;

import java.util.List;

import org.apache.log4j.Logger;

import com.yb.base.dao.BaseDao;
import com.yb.base.dao.IBaseDao;
import com.yb.domain.goods.TgCategory;
import com.yb.domain.goods.TpGongLue;

public class PgGongLueServiceImpl implements PgGongLueService {
	
	 private  IBaseDao<TpGongLue, Long>  dao ;
	 private static final Logger LOGGER = Logger.getLogger(PgGongLueServiceImpl.class);
	 public  PgGongLueServiceImpl(){
		 dao =  new BaseDao<TpGongLue, Long>(TpGongLue.class);
	 }
	 public boolean  addOrUpdate(TpGongLue tp){
		 try{
			    dao.saveOrUpdate(tp);
				return true;
			}catch (Exception e) {
				 LOGGER.error("PgGongLueServiceImpl  saveOrUpdate error", e);
				return false;
			}
	 }
	 public  TpGongLue  find(){
			try{
				String  str="select * from   t_pg_glue  ";
				List<TpGongLue>  list= dao.findList(str);
				if(list!=null && !list.isEmpty())
				{
					return list.get(0);
				}
			
			}catch (Exception e) {
				e.printStackTrace();
			}
			return null;
	 }
}
